//
//  Emoticons.swift
//  KeyBoard
//
//  Created by mac on 15/12/26.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

class Emoticons: NSObject {
    //图片的路径
    var id:String?
    //emoji的十六进制图片
    var code: String?
    //表情文本
    var chs: String?
    //图片名称
    var png: String?
    //添加图片路径的计算型属性
    var imagePath: String? {
        let ids = id ?? ""
        let pngs = png ?? ""
            //获取path
            let path = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + "\(ids)/" + "\(pngs)"
//        print(path)
            return path
    }
    //添加emoji的文本
    var codeStr :String? {
        guard let codeStr = code else {
            return nil
        }
        return codeStr.emojiStr()
    }
    
    //添加删除按钮的标记
    var isDelete = false
    
    //添加空按钮的标记
    var isEmpty = false
    
    init(dict: [String:String]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    init(isDelete:Bool){
        self.isDelete = isDelete
        super.init()
    }
    init(isEmpty:Bool){
        self.isEmpty = isEmpty
        super.init()
    }
    
    //过滤无用字段
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
    }
    override var description: String {
        let keys = ["chs","png","code"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
